home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Text / Textension / Include / exceptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-21  |  1.0 KB  |  42 lines  |  [TEXT/MPS ]

  1. #ifndef __EXCEPTIONS__
  2. #define __EXCEPTIONS__
  3.  
  4. #if !defined(txtnDebug)
  5. #define NDEBUG
  6. #endif
  7.  
  8. #include <Assert.h>
  9.  
  10. #define check(exp) assert(exp)
  11. #define ncheck(exp) assert(!(exp))
  12.  
  13. #define    __DebuggerBreak    Debugger()
  14.  
  15. #define require_action(assertion, exception, action)                        \
  16.     do {                                                                                    \
  17.         if (assertion) ;                                                                \
  18.         else {                                                                            \
  19.             __DebuggerBreak;                                                            \
  20.             { action }                                                                    \
  21.             goto exception;                                                            \
  22.         }                                                                                    \
  23.     } while (false)
  24.  
  25. #define require(assertion, exception)                                            \
  26.     do {                                                                                    \
  27.         if (assertion) ;                                                                \
  28.         else {                                                                            \
  29.             __DebuggerBreak;                                                            \
  30.             goto exception;                                                            \
  31.         }                                                                                    \
  32.     } while (false)
  33.  
  34. #define nrequire(assertion, exception)                                            \
  35.     do {                                                                                    \
  36.         if (assertion) {                                                                \
  37.             DebugStr("\p##assertion");                                                                    \
  38.             goto exception;                                                            \
  39.         }                                                                                    \
  40.     } while (false)
  41.  
  42. #endif